home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tex / macros / contrib / semrot.sty < prev    next >
Encoding:
Text File  |  1995-03-15  |  2.8 KB  |  71 lines

  1. %% BEGIN sem-rot.sty
  2. \def\fileversion{1.0}
  3. \def\filedate{93/04/01}
  4. %%
  5. %% LaTeX style option `semrot.sty'.
  6. %% For use with LaTeX v2.09 and the `seminar' document style.
  7. %%
  8. %% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU
  9. %% See seminar.sty or seminar.doc for copying restrictions.
  10. %%
  11. %% The following is just an interface for seminar.sty:
  12. \def\leftsliderotation#1{\@rotate[l]{#1}}
  13. \def\rightsliderotation#1{\@rotate[r]{#1}}
  14. \sliderotation{left}
  15. %%
  16. %% And the rest is rotate.sty, as distributed with Rokicki's dvips.
  17. %%
  18. %   These macros allow you to rotate or flip a \TeX\ box.  Very useful for
  19. %   sideways tables or upsidedown answers.
  20. %
  21. %   To use, create a box containing the information you want to rotate.
  22. %   (An hbox or vbox will do.)  Now call \@rotr\boxnum to rotate the
  23. %   material and create a new box with the appropriate (flipped) dimensions.
  24. %   \@rotr rotates right, \@rotl rotates left, \@rotu turns upside down, and
  25. %   \@rotf flips.  These boxes may contain other rotated boxes.
  26. %
  27. \newdimen\@rotdimen
  28. \newbox\@rotbox
  29.  
  30. \def\@vspec#1{\special{ps:#1}}%  passes #1 verbatim to the output
  31. \def\@rotstart#1{\@vspec{gsave currentpoint currentpoint translate
  32.    #1 neg exch neg exch translate}}% #1 can be any origin-fixing transformation
  33. \def\@rotfinish{\@vspec{currentpoint grestore moveto}}% gets back in synch
  34. %
  35. %   First, the rotation right. The reference point of the rotated box
  36. %   is the lower right corner of the original box.
  37. %
  38. \def\@rotr#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
  39.    \hbox to\@rotdimen{\hskip\ht#1\vbox to\wd#1{\@rotstart{90 rotate}%
  40.    \box#1\vss}\hss}\@rotfinish}
  41. %
  42. %   Next, the rotation left. The reference point of the rotated box
  43. %   is the upper left corner of the original box.
  44. %
  45. \def\@rotl#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
  46.    \hbox to\@rotdimen{\vbox to\wd#1{\vskip\wd#1\@rotstart{270 rotate}%
  47.    \box#1\vss}\hss}\@rotfinish}%
  48. %
  49. %   Upside down is simple. The reference point of the rotated box
  50. %   is the upper right corner of the original box. (The box's height
  51. %   should be the current font's xheight, \fontdimen5\font,
  52. %   if you want that xheight to be at the baseline after rotation.)
  53. %
  54. \def\@rotu#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
  55.    \hbox to\wd#1{\hskip\wd#1\vbox to\@rotdimen{\vskip\@rotdimen
  56.    \@rotstart{-1 dup scale}\box#1\vss}\hss}\@rotfinish}%
  57. %
  58. %   And flipped end for end is pretty ysae too. We retain the baseline.
  59. %
  60. \def\@rotf#1{\hbox to\wd#1{\hskip\wd#1\@rotstart{-1 1 scale}%
  61.    \box#1\hss}\@rotfinish}%
  62. %
  63. %   Now the user interface for LaTeX:  \rotate[type]{text} where
  64. %   ``type'' is `l' for left, `r' for right, `u' for upside-down, or
  65. %   `f' for flip.  `l' is the default.
  66. %
  67. \def\rotate{\@ifnextchar[{\@rotate}{\@rotate[l]}}
  68. \def\@rotate[#1]#2{\setbox\@rotbox=\hbox{#2}\@nameuse{@rot#1}\@rotbox}
  69. \endinput
  70. %% END sem-rot.sty
  71.